/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lolbuilder.calculation;


import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import lolbuilder.Champions.Impl.GenericChamp;
import lolbuilder.Champions.Interf.DummyChamp;
import lolbuilder.Items.Interf.ItemsSuper;
import lolbuilder.build.Build;
import lolbuilder.mainClasses.AllItems;
import lolbuilder.params.Parameters;

/**
 *
 * @author chocoboSan
 */
public class CalculateValueOfAdItems extends Thread{
    public boolean finished=false;
    ArrayList<ItemsSuper> items;
    public String resultToPrint;
    
    public CalculateValueOfAdItems() {
    }
    
    @Override
    public void run() {
        resultToPrint="I'm gonna calculate value of Ad items\n";
        items=AllItems.items;
        for (ItemsSuper i : items) {
            if (i.isAdItem) {
                Build b=new Build();
                b.items.add(i);
                DummyChamp c =null;
                try {
                    c=Parameters.champUsedForAd.getClass().newInstance();
                } catch (InstantiationException ex) {
                    Logger.getLogger(CalculateValueOfAdItems.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IllegalAccessException ex) {
                    Logger.getLogger(CalculateValueOfAdItems.class.getName()).log(Level.SEVERE, null, ex);
                }
                b.applyThisBuild(c);
                c.calculateDpsOver5sec();
                resultToPrint+="Value of "+i+" is "+i.price+", real effectiveness is : "+c.dpsOver5sec*100/i.price+"\n";
            }
        }
        finished=true;
    }
}
